import pandas as pd
import json
import os


def getSetting():
    if os.path.isfile("setting.xlsx"):
        tmp = pd.read_excel("setting.xlsx")
        setting = {}
        title = {}
        col = {}
        for index in tmp['列名'].index:
            title[tmp['列名'][index]] = tmp['重命名'][index]
            tmp['数据'][index] = tmp['新数据'][index]
            setting['title'] = title
            setting['col']=
    else:
        with open("setting.json", "r", encoding="utf-8") as file:
            setting = json.loads(file.read())
    return setting


with open("s.json", "r", encoding="utf-8") as file:
    tmp = json.loads(file.read())
getSetting()
setting = pd.read_excel("setting.xlsx")
print(setting.columns)
for key in setting.columns:
    print(key)
df = pd.read_excel("x.xlsx")
print(df.columns)
print(df.index)
df.rename(columns=tmp['title'], inplace=True)

for key in tmp['col'].keys():
    df[key] = df[key].astype(str).replace(tmp['col'][key])
    print(key)

print(df)
df.to_excel("ss.xlsx")
